<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>记账系统 - 查询</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
</head>
<body>

	<div class="container">
		<div class="row">
			<div class="col-md-12 page-header">
				<h2 class="text-center">
					记账系统<br />
					<small>查询</small>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-8">
				<ul class="nav nav-pills">
					<li><a href="#">用户： <span id="text3"></span>
					</a></li>

					<li><a href="index.html">首页</a></li>
					<li><a href="xjsr.html">新加收入</a></li>
					<li><a href="xjzc.html">新加支出</a></li>
					<li><a href="month.html">当月统计</a></li>
					<li class="active"><a href="#">查询</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<hr />


			<div class="container">
				<div class="row">
					<div class="col-md-4">


						<div class="form-group">
							<label for="date_time">时间</label> <input type="date"
								class="form-control" id="date_time" />
						</div>
						<div class="form-group">
							<label for="place">地点</label> <input type="text"
								class="form-control" id="place" />
						</div>
						<div class="form-group">
							<label for="money_in">收入</label> <input type="text"
								class="form-control" id="money_in" />
						</div>
						<div class="form-group">
							<label for="money_out">支出</label> <input type="text"
								class="form-control" id="money_out" />
						</div>
						<div class="form-group">
							<label for="kind">类型</label> <input type="text"
								class="form-control" id="kind" />
						</div>
						<div class="form-group">
							<label for="remark">备注</label> <input type="text"
								class="form-control" id="remark" />
						</div>
						<button id="queryall" class="btn btn-primary btn-block">查询</button>
					</div>

					<div class="col-md-8">
						<div class="panel panel-success">
							<div class="panel-heading">查询结果</div>
							<div class="panel-body" id="list1"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script id="template" type="text/x-handlebars-template">
   {{#each item}}
  	<div class="panel panel-default col-md-3" >
    	 <div class="panel-body">
     	  <dl>
     	   <dt>ID</dt><dd>{{id}}</dd>
     	   <dt>时间</dt><dd>{{date_time}}</dd>
     	   <dt>地点</dt><dd>{{place}}</dd>
     	   <dt>收入</dt><dd>{{money_in}}</dd>
     	   <dt>支出</dt><dd>{{money_out}}</dd>
     	   <dt>类别</dt><dd>{{kind}}</dd>
           <dt>备注</dt><dd>{{remark}}</dd>
  		   <a href="querydes.html?id={{id}}" class="button">显示详情</a>
       </dl>  
      </div>
    </div>
 {{/each}}
</script>
		<script type="text/javascript">
			$(function() {
				$.getJSON('query_nickname.action', function(res) {
					console.log(res);
					$('#text3').text(res.昵称);
				});
				$('#queryall').click(function() {
					$.post('queryall.action', {

						id : $('#id').val(),
						date_time : $('#date_time').val(),
						money_in : $('#money_in').val(),
						money_out : $('#money_out').val(),
						kind : $('#kind').val(),
						place : $('#place').val(),
						remark : $('#remark').val()
					}, function(res, status) {
						var data = {
							'item' : res
						};
						var t = Handlebars.compile($('#template').html());
						$('#list1').html(t(data));
					})

				});
				$.getJSON('query_nickname.action', function(res) {
					console.log(res);
					$('#text3').text(res.nickname);

				});
			});
		</script>
</body>
</html>
